#include "StdAfx.h"
#include "EString.h"
#include "VirtualFile.h"

using namespace System;
using namespace AID;

VirtualFile::VirtualFile(System::String name, VirtualFile* parent)
:m_isComplete(false), m_isFolder(false), m_folderInfo(NULL)
{
	computePath();
}

VirtualFile* VirtualFile::createRoot(void)
{
	return new VirtualFile(L"/", NULL);
}

VirtualFile::~VirtualFile(void)
{
}

const VirtualFileList&	VirtualFile::getChildren(FolderHandlerBase* virtualFolderHandler)
{
	if (m_isComplete)
		return m_children;
	return m_children;
}

void VirtualFile::computePath(void)
{
	if (m_parent != NULL)
	{
		m_path = m_parent->getPath();
		m_path += L"/";
		m_path += m_name;
	}
	else
	{
		m_path = L"/";
	}
}

const String&	VirtualFile::getPath(void) const
{
	return m_path;
}

void VirtualFile::setCompleted()
{
	m_isComplete = true;
}